package com.muk.meis.model.service;

import java.util.List;

import javax.persistence.EntityTransaction;

import com.muk.meis.model.bean.Question;

public class QuestionService extends BaseMEISService {

	public List<Question> getList(String percodeCode) {
		return em.createQuery(
				"select e from Question e where e.percodeCode = '"+ percodeCode + "'"+
		        " order by e.createDate desc", 
				Question.class).getResultList();
	}
	
	public Question getDetail(int questionId){
		return em.find(Question.class, questionId);
	}
	
	public void create(Question question){
		EntityTransaction t = em.getTransaction();
		t.begin();
		em.persist(question);
		t.commit();
	}
	
}
